﻿@{
    ViewBag.Title = "RptPosDay";
}

@section scripts
{ 
    <script src="@Url.Content("~/Scripts/shared/share.js")" type="text/javascript"></script> 
    <script src="@Url.Content("~/Scripts/shared/shown.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/common/gridlayout.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/common/export.js")" type="text/javascript"></script>
}
    @Html.Partial("~/Views/Modular/ReportsToolbar.cshtml")
<form id="form1">
    <div id = "DivHeader">
        <table style="margin-bottom:4px;">
            <tr>
                <td width ="70px" align="right">日期范围：</td>
                <td width ="310px">                    
                    @Html.Partial("~/Views/Modular/dxDateRange.cshtml") 
                </td>
                <td width ="70px" align="right">门店名称：</td>
                <td width ="190px">    
                    @Html.Partial("~/Views/Modular/LookupStockInfo.cshtml")                      
                </td>
           </tr>
        </table>
    </div>
</form>
        <div class="mini-fit" >
            <div id="datagrid1" class="mini-datagrid" style="width:100%;height:100%;" pageSize="15"
                    borderStyle="border:1;" url="../Report/Rpt_PosDay"  showSummaryRow="true"
                    allowCellSelect="true" allowCellEdit="true"showColumnsMenu="true"fitColumns="false"  
                    sortMode="client"  ondrawsummarycell="onDrawSummaryCell">
                <div property="columns">
                    <div type="checkcolumn" >选行</div>
                    <div type="indexcolumn" width="40" headerAlign="center" >序号</div>
                    <div field="FDate" name="FDate" width="100" headeralign="center" allowsort="true">日期</div>
                    <div field="FNumber" name="FNumber" width="100" headeralign="center" allowsort="true">门店编号</div>
                    <div field="FName" name="FName" width="170" headeralign="center" allowsort="true">门店名称</div>
                    <div field="FQty" name="FQty" width="100" headeralign="center" allowsort="true" align="right" numberFormat="#,0.0000">数量</div>
                    <div field="FAmount" name="FAmount" width="110" headeralign="center" allowsort="true" align="right" numberFormat="#,0.00">金额</div>
                    <div field="FRealAmount" name="FRealAmount" width="110" headeralign="center" allowsort="true" align="right" numberFormat="#,0.00">实收金额</div>
                    <div field="FCostAmount" name="FCostAmount" width="110" headeralign="center" allowsort="true"align="right" numberFormat="#,0.00">成本</div>
                    <div field="FProfit" name="FProfit" width="110" headeralign="center" allowsort="true" align="right" numberFormat="#,0.00">毛利</div>
                </div>
            </div>
        </div>

<script>
    var sumFields = "FQty,FAmount,FRealAmount,FCostAmount,FProfit";
    function FormShown() {
        mini.parse();
        var toDay = new Date();
        mini.getbyName("FDate1").setValue(toDay);
        mini.getbyName("FDate2").setValue(toDay);
    }

    $(function () { LoadData(); });

    //加载资料列表
    function LoadData() {
        var sSystemAppID = parent.window.getSystemAppID();
        var form = new mini.Form("#form1");
        var data = form.getData();
        data.FDate1 = mini.getbyName("FDate1").getFormValue();
        data.FDate2 = mini.getbyName("FDate2").getFormValue();
        var datajson = mini.encode(data);

        var json = "[{";
        json = json + "'FSystemAppID':" + "'" + sSystemAppID + "',";
        json = json + "'search':" + "'" + datajson + "'";
        json = json + "}]";
        var grid = mini.get("datagrid1");
        grid.load({ mydata: json });

        mExportDataUrl = grid.url;
        mExportDataJson = json;//导出
    }

    function search() {
        LoadData();

    }
    function printdata() {
        var grid = mini.get("datagrid1");
        var url = "../Report/PrintReport";
        mini.open({
            url: url,
            title: "打印", width: 1000, height: 700,
            onload: function () {
                var iframe = this.getIFrameEl();
                var NoneDisplayCol = [0];
                iframe.contentWindow.InitalPrint(grid, NoneDisplayCol, parent.window.getSystemCompany() + "零售汇总日报表");
            }
        });
    }

    function clearloca() {
        mini.getbyName("FStockID").setValue("");
        mini.getbyName("FStockID").setText("");
        mini.getbyName("FStockName").setValue("");
        var nowDate = new Date();
        mini.getbyName("FDate1").setValue(nowDate);
        mini.getbyName("FDate2").setValue(nowDate);
        mini.getbyName("comdatasel").setValue("0");
    }

</script>



